package com.chencs.app.lianmeng.controller;


import com.alibaba.fastjson.JSON;
import com.chencs.app.AppCommon;
import com.chencs.app.lianmeng.service.LMMemberSer;
import com.chencs.vo.net.lmrequest.LmLoginRequest;
import com.chencs.vo.net.lmrequest.LmMessageRequest;
import com.chencs.vo.net.lmrequest.LmRegisterRequest;
import com.chencs.vo.net.lmrequest.LmTeamRequest;
import com.chencs.vo.net.lmresponse.LmLoginResponse;
import com.chencs.vo.net.lmresponse.LmRegisterResponse;
import com.chencs.vo.net.lmresponse.LmTeamResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 会员相关
 */
@RestController
@RequestMapping("/app/lmMember")
public class LMMemberCtr {



    @Autowired
    private LMMemberSer memberSer;
    /**
     * 帐号密码登录
     * @param request
     * @return
     */
    @RequestMapping(value = "/loginForPwd", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String loginForPwd(@RequestBody LmRegisterRequest request){
        LmRegisterResponse response = null;

        return JSON.toJSONString(response);
    }

    /**
     * 微信登录
     * @param request
     * @return
     */
    @RequestMapping(value = "/loginForWx", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String loginForWx(@RequestBody LmLoginRequest request){
        LmLoginResponse response = memberSer.findUserByWXId(request);
        return JSON.toJSONString(response);
    }

    /**
     * 用户注册
     * @param request
     * @return
     */
    @RequestMapping(value = "/register", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String register(@RequestBody LmRegisterRequest request){
        LmRegisterResponse response = memberSer.createMember(request);

        return JSON.toJSONString(response);
    }

    /**
     * 我的团队1
     * @param request
     * @return
     */
    @RequestMapping(value = "/getTeam1", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getTeam1(@RequestBody LmTeamRequest request){
        LmTeamResponse response = memberSer.getTeamLeve1(request);
        return JSON.toJSONString(response);
    }

    /**
     * 我的团队2
     * @param request
     * @return
     */
    @RequestMapping(value = "/getTeam2", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getTeam2(@RequestBody LmTeamRequest request){
        LmTeamResponse response = memberSer.getTeamLeve2(request);
        return JSON.toJSONString(response);
    }



}
